Git Branching - Basic Branching and Merging

>git checkout -b iss53

Switched to a new branch "iss53"

This is shorthand for:

>git branch iss53

>git checkout iss53

>vim index.html

>git commit -a -m 'Create new footer]'

>git checkout master

Switched to branch 'master'

>git checkout -b hotfix

Switched to a new branch 'hotfix'

>vim index.html

>git commit -a -m 'Fix broken email address'

[hotfix 1fb7853] Fix broken email address

1 file changed, 2 insertions(+)

>git checkout master

>git merge hotfix

Updating f42c576..3a0874c

Fast-forward

index.html | 2 ++

1 file changed, 2 insertions(+)

>git branch -d hotfix

Deleted branch hotfix (3a0874c).

>git checkout iss53

Switched to branch "iss53"

>vim index.html

>git commit -a -m 'Finish the new footer'

[iss53 ad82d7a] Finish the new footer

1 file changed, 1 insertion(+)

Basic Merging

>git checkout master

Switched to branch 'master'

>git merge iss53

Merge made by the 'recursive' strategy.

index.html | 1 +

1 file changed, 1 insertion(+)

Now that your work is merged in, you have no further need for the iss53 branch. You can close the issue in your issue-tracking system, and delete the branch:

esc :wq

git push -u origin new-features

Create pr

i got conflic

>git pull origin master

incase of complext conflict

Step 1: From your project repository, bring in the changes and test.

>git fetch origin

>git checkout -b seller-module origin/seller-module

>git merge master

Step 2: Merge the changes and update on GitHub.

>git checkout master

>git merge --no-ff seller-module

>git push origin master

View More...

CRUD API in Django using APIVIEW

class BrandList(APIView):

"""

List all colors, or create a new color.

"""

def get(self, request, format=None):

brands = Brand.objects.all()

try:

start = int(request.query_params['start'])

limit = int(request.query_params['limit'])

serializer = BrandSerializer(brands[start:start + limit], many=True)

except:

start, limit = 0, 0

serializer = BrandSerializer(brands, many=True)

return Response({"total_result": len(brands), "start": start, "limit": limit, "data": serializer.data})

def post(self, request, format=None):

if title_validate(request.data['titles']) is not None:

return Response({"message": title_validate(request.data['titles'])}, status=status.HTTP_400_BAD_REQUEST)

for title in request.data['titles']:

request.data['brand_title'] = title

serializer = BrandSerializer(data=request.data)

if serializer.is_valid():

serializer.save()

else:

return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)

brands = Brand.objects.all()

serializer = BrandSerializer(brands, many=True)

return Response(serializer.data, status=status.HTTP_201_CREATED)

class BrandDetail(APIView):

"""

Retrieve, update or delete a color instance.

"""

def get(self, request, pk, format=None):

try:

brand = Brand.objects.get(pk=pk)

serializer = BrandSerializer(brand)

return Response(serializer.data)

except Brand.DoesNotExist:

return Response({"message": "Brand not found"}, status=status.HTTP_404_NOT_FOUND)

def put(self, request, pk, format=None):

brand = Brand.objects.get(pk=pk)

try:

request.data['brand_title'] = request.data['brand_title'][0]

except:

return Response({"brand_title": ["Not a valid array."]}, status=status.HTTP_400_BAD_REQUEST)

serializer = BrandSerializer(brand, data=request.data)

if serializer.is_valid():

serializer.save()

brands = Brand.objects.all()

serializer = BrandSerializer(brands, many=True)

return Response(serializer.data)

return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)

View More...

SSL Enable

sudo certbot --apache -d tech-overflow.com -d www.tech-overflow.com

sudo certbot --apache -d tech-question.com -d www.tech-question.com

sudo certbot --apache -d python-ds.com -d www.python-ds.com

sudo certbot --apache -d python-ds.com -d www.python-ds.com

cat /etc/apache2/apache2.conf

https://www.digitalocean.com/community/tutorials/apache-configuration-error-ah00558-could-not-reliably-determine-the-server-s-fully-qualified-domain-name

https://www.ssllabs.com/ssltest/analyze.html?d=python%2dds.com&latest

https://www.ssllabs.com/ssltest/analyze.html?d=www.python-ds.com

View More...

First Previous 10 11 12 13 14 Next Last