File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -362,3 +362,30 @@ What you can do is the following:
362362 ```
363363
3643646. Use `fromBranch` in your assignment config.
365+
366+ If you are doing this more often, you want to add a git alias like
367+
368+ ```git
369+ [alias]
370+ new-semester = "!f() { \
371+ BRANCH=${1:-ws24}; \
372+ MSG=${2:-Initial}; \
373+ if git show-ref --verify --quiet refs/heads/$BRANCH; then \
374+ echo \"Error: Branch '$BRANCH' already exists. Please delete it first or choose another name.\"; \
375+ return 1; \
376+ fi; \
377+ CURRENT=$(git branch --show-current) && \
378+ git checkout -b $BRANCH && \
379+ COMMIT=$(git commit-tree HEAD^{tree} -m \"$MSG\") && \
380+ git reset $COMMIT && \
381+ git push origin $BRANCH && \
382+ git checkout $CURRENT && \
383+ echo \"Branch '$BRANCH' created and pushed. Returned to '$CURRENT'\"; \
384+ }; f"
385+ ```
386+
387+ and use it like so
388+
389+ ``` sh
390+ git new-semester ws24 " Initial"
391+ ```
You can’t perform that action at this time.
0 commit comments